package com.kuang;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.Test;

import java.io.FileInputStream;

/**
 * @Auther: LIJingQi
 * @Description: 读excel测试
 * @Date: 2022/5/28 23:05
 */
public class exlceReadTest {
    String PATH="C:\\Users\\73161\\Desktop\\mySelf\\springboot-redis-first-try\\poi\\";
    @Test
    public void testRead03() throws Exception{
        FileInputStream inputStream = new FileInputStream(PATH + "poitestWrite03Time.xls");
        HSSFWorkbook workbook = new HSSFWorkbook(inputStream);
        HSSFSheet sheet = workbook.getSheetAt(0);
        HSSFRow row = sheet.getRow(0);
        HSSFCell cell = row.getCell(0);
        System.out.println(cell.getNumericCellValue());
        inputStream.close();

    }
    @Test
    public void testRead07() throws Exception{
        FileInputStream inputStream = new FileInputStream(PATH + "poitestWrite07Time.xlsx");
        XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
        Sheet sheet = workbook.getSheetAt(0);
        Row row = sheet.getRow(0);
        Cell cell = row.getCell(0);
        System.out.println(cell.getNumericCellValue());
        inputStream.close();

    }
}
